<!--{include(pe_tpl('header.html'));}-->
<div class="right_page">
	<div class="now">
		<a href="admin.php?mod=product" <!--{if(!$_g_filter):}-->class="sel"<!--{endif;}-->>出售中（{$tongji['all']}）<i></i></a>
		<a href="admin.php?mod=product&filter=xiajia" <!--{if($_g_filter=='xiajia'):}-->class="sel"<!--{endif;}-->>已下架（{$tongji['xiajia']}）<i></i></a>
		<a href="admin.php?mod=product&filter=quehuo" <!--{if($_g_filter=='quehuo'):}-->class="sel"<!--{endif;}-->>缺货中（{$tongji['quehuo']}）<i></i></a>
		<a href="admin.php?mod=product&filter=tuijian" <!--{if($_g_filter=='tuijian'):}-->class="sel"<!--{endif;}-->>推荐（{$tongji['tuijian']}）<i></i></a>
		<a href="admin.php?mod=product&filter=xinpin" <!--{if($_g_filter=='xinpin'):}-->class="sel"<!--{endif;}-->>新品（{$tongji['xinpin']}）<i></i></a>
		<a href="admin.php?mod=product&act=add&type=fixed" id="fabu">添加商品</a>
		<div class="clear"></div>
	</div>
	<div class="right_main">
		<div class="search">
			<form method="get">
			<input type="hidden" name="mod" value="{$_g_mod}" />
			<input type="hidden" name="filter" value="{$_g_filter}" />
			商品名称：<input type="text" name="name" value="{$_g_name}" class="inputtext input200" />
			<select name="category_id" class="selectmini">
			<option value="">全部分类</option>
			<!--{foreach($category_treelist as $v):}-->
			<option value="{$v['category_id']}" <!--{if($_g_category_id==$v['category_id']):}-->selected="selected"<!--{endif;}-->>{$v['category_showname']}</option>
			<!--{endforeach;}-->
			</select>
			<select name="brand_id" class="selectmini">
			<option value="">全部品牌</option>
			<!--{foreach($cache_brand as $v):}-->
			<option value="{$v['brand_id']}" <!--{if($_g_brand_id==$v['brand_id']):}-->selected="selected"<!--{endif;}-->>[{$v['brand_word']}] {$v['brand_name']}</option>
			<!--{endforeach;}-->
			</select>
			<select name="orderby" class="selectmini">
			<option value="">默认排序</option>
			<!--{foreach($orderby_arr as $k=>$v):}-->
			<option value="{$k}" <!--{if($_g_orderby==$k):}-->selected="selected"<!--{endif;}-->>{$v}</option>
			<!--{endforeach;}-->
			</select>
			<input type="submit" value="搜索" class="input_btn" />
			</form>
		</div>
		<form method="post" id="form">
		<table border="0" cellspacing="0" cellpadding="0" class="list">
		<tr>
			<th class="bgtt" width="20"><input type="checkbox" name="checkall" onclick="pe_checkall(this, 'product_id')" /></th>
			<th class="bgtt" width="50">ID号</th>
			<th class="bgtt" width="60">排序</th>
			<th class="bgtt" width="50"></th>
			<th class="bgtt">商品名称</th>
			<th class="bgtt" width="80">价格</th>
			<th class="bgtt" width="70">库存</th>
			<th class="bgtt" width="80">销量(虚拟)</th>
			<th class="bgtt" width="70">评价</th>
			<th class="bgtt" width="80">上架</th>
			<th class="bgtt" width="100">操作</th>
		</tr>
		<!--{foreach($info_list as $v):}-->
		<tr>
			<td><input type="checkbox" name="product_id[]" value="{$v['product_id']}" /></td>
			<td>{$v['product_id']}</td>
			<td><input type="text" name="product_order[{$v['product_id']}]" value="{$v['product_order']}" class="inputtext input50 center" style="padding:5px" /></td>
			<td><a href="{pe_url('product-'.$v['product_id'])}" target="_blank"><img src="{pe_thumb($v['product_logo'], 100, 100)}" width="50" height="50" class="imgbg" /></a></td>
			<td class="left">
				<a href="{pe_url('product-'.$v['product_id'])}" target="_blank" class="cblue">{$v['product_name']}</a>
				<div class="mat10">
					<!--{if($v['category_id']):}--><span class="tag_gray">{$cache_category[$v['category_id']]['category_name']}</span><!--{endif;}-->
					<!--{if($v['category_id2']):}--><span class="tag_gray">{$cache_category[$v['category_id2']]['category_name']}</span><!--{endif;}-->
					<!--{if($v['product_tuijian']):}--><span class="tag_org">推荐</span><!--{endif;}-->
					<!--{if($v['product_xinpin']):}--><span class="tag_org">新品</span><!--{endif;}-->
					<!--{if($v['product_virtual']):}--><a href="admin.php?mod=prokey&act=list&state=new&id={$v['product_id']}" onclick="return pe_dialog(this, '《{$v['product_name']}》卡密管理', 1000, 650)" class="tag_blue">卡密管理</a><!--{endif;}-->
				</div>	
			</td>
			<td><span class="corg">{$v['product_money']}</span></td>
			<td><span <!--{if(!$v['product_num']):}-->class="cred strong"<!--{endif;}-->>{$v['product_num']}</span></td>
			<!--<td class="num">{$v['product_clicknum']}</td>-->
			<td><a href="admin.php?mod=buyer&product_id={$v['product_id']}" onclick="return pe_dialog(this, '销量助手管理', 1000, 650)">{$v['product_sellnum']}<span class="cbbb">({$v['product_sellnum_virtual']})</span></a></td>
			<td><a href="admin.php?mod=product&act=comment&id={$v['product_id']}" onclick="return pe_dialog(this, '发表评价', 1000, 650, 'product_comment')">{$v['product_commentnum']}</a></td>
			<td class="layui-form">
				<input type="checkbox" <!--{if($v['product_state']==1):}-->checked<!--{endif;}--> lay-skin="switch" lay-text="上架|下架" url="admin.php?mod=product&act=state&id={$v['product_id']}&token={$pe_token}" />
			</td>
			<td>
				<a href="admin.php?mod=product&act=edit&id={$v['product_id']}&{pe_jump()}" class="admin_edit mar3">修改</a>
				<a href="javascript:pe_confirm('删除', 'admin.php?mod=product&act=del&id={$v['product_id']}&token={$pe_token}')" class="admin_del">删除</a>
			</td>
		</tr>
		<!--{endforeach;}-->
		</table>
		</form>
	</div>
	<div class="right_bottom">
		<span class="fl">
			<input type="checkbox" name="checkall" onclick="pe_checkall(this, 'product_id')" />
			<input type="button" onclick="pe_checksel('product_id') && pe_confirm('批量删除', 'admin.php?mod=product&act=del&token={$pe_token}', true)" value="批量删除" />
			<input type="button" onclick="pe_confirm('更新排序', 'admin.php?mod=product&act=order&token={$pe_token}', true)" value="更新排序" />
			<input type="button" onclick="pe_checksel('product_id') && pe_confirm('批量上架', 'admin.php?mod=product&act=state&value=1&token={$pe_token}', true)" value="批量上架" />
			<input type="button" onclick="pe_checksel('product_id') && pe_confirm('批量下架', 'admin.php?mod=product&act=state&value=0&token={$pe_token}', true)" value="批量下架" />
			<input type="button" onclick="pe_checksel('product_id') && pe_confirm('设置推荐', 'admin.php?mod=product&act=tuijian&value=1&token={$pe_token}', true)" value="设置推荐" />
			<input type="button" onclick="pe_checksel('product_id') && pe_confirm('取消推荐', 'admin.php?mod=product&act=tuijian&value=0&token={$pe_token}', true)" value="取消推荐" />
			<input type="button" onclick="pe_checksel('product_id') && pe_confirm('设置新品', 'admin.php?mod=product&act=xinpin&value=1&token={$pe_token}', true)" value="设置新品" />
			<input type="button" onclick="pe_checksel('product_id') && pe_confirm('取消新品', 'admin.php?mod=product&act=xinpin&value=0&token={$pe_token}', true)" value="取消新品" />
			<button type="button" onclick="product_move()">批量转移商品</button>
		</span>
		<span class="fr fenye">{$db->page->html}</span>
		<div class="clear"></div>
	</div>
</div>
<link rel="stylesheet" href="{$pe['host']}include/plugin/layui/css/layui.css">
<script src="{$pe['host']}include/plugin/layui/layui.js"></script>
<script type="text/javascript">
layui.use(['form'], function(){
	form = layui.form;
	form.on('switch', function(data){
		var url = $(this).attr("url") + "&value=" + (this.checked ? 1 : 0)
		pe_get(url);
	});
});
function product_move() {
	var product_id = new Array();
	if ($("input[name='product_id[]']").filter(":checked").length == 0) {
		alert('请先勾选需要转移的商品!');
		return false;
	}
	$("input[name='product_id[]']").filter(":checked").each(function(i){
		product_id[i] = $(this).val();
	})
	product_id = product_id.join(',');
	var layer_index = layer.open({
		type: 2,
		title: '批量转移商品',
		area: ['600px', '300px'],
		fixed: false, //不固定
		shadeClose: true,
		shade: 0.5,
		content: "{$pe['host']}admin.php?mod=product&act=move&id="+product_id //iframe的url
	});
}
</script>
<style type="text/css">
.ico_btn img{height:18px;display:inline-block;margin-left:5px;}
</style>
<!--{include(pe_tpl('footer.html'));}-->